import React, { useRef } from 'react'

export default function App () {

  const inputRef = useRef(null);

  function handleClick () {
    inputRef.current.focus()
  }
  return (
    <>
      <input ref={inputRef} type="text" />
      <button onClick={handleClick}>聚焦输入框</button>
    </>
  )
}
